home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 July / EnigmA AMIGA RUN 20 (1997)(G.R. Edizioni)(IT)[!][issue 1997-07 & 08][EAR-CD IV].iso / lightwave / lwmlist / 95.lightwave-08 / 000112_owner-lightwav…bcom.webcom.com_Wed Aug 9 17:08:42 1995.msg < prev    next >
Internet Message Format  |  1995-09-02  |  7KB

  1. Received: by webcom.webcom.com
  2.     (1.37.109.15/16.2) id AA227033321; Wed, 9 Aug 1995 17:08:42 -0700
  3. Return-Path: <owner-lightwave@webcom.webcom.com>
  4. Received: from nova.unix.portal.com by webcom.webcom.com with ESMTP
  5.     (1.37.109.15/16.2) id AA226783312; Wed, 9 Aug 1995 17:08:33 -0700
  6. Received: from hobo.online.portal.com (hobo.online.portal.com [156.151.5.5]) by nova.unix.portal.com (8.6.11/8.6.5) with ESMTP id QAA14821 for <lightwave@webcom.com>; Wed, 9 Aug 1995 16:59:29 -0700
  7. From: Kathy@cup.portal.com
  8. Received: (pccop@localhost) by hobo.online.portal.com (8.6.10/8.6.5) id QAA23355 for lightwave@webcom.com; Wed, 9 Aug 1995 16:59:28 -0700
  9. To: lightwave@webcom.webcom.com
  10. Subject: Loading scenes into Modeler macro
  11. Lines: 211
  12. Date: Wed,  9 Aug 95 16:59:27 PDT
  13. Message-Id: <9508091659.1.23128@cup.portal.com>
  14. X-Origin: The Portal System (TM)
  15. Sender: owner-lightwave@webcom.webcom.com
  16. Precedence: bulk
  17.  
  18. Here's a macro I wrote which loads scenes into Modeler. Handy for things
  19. like loading the posed Humanoid into Modeler, modeling with sized and
  20. positioned scene objects available etc.
  21.     
  22. Cut here
  23. -------------------------------------------------------------------------
  24. /* CMD:Sceneload */
  25. /* Loads objects from Lightwave scene, maintains hierarchy */
  26. /* Brought to you by the Texas Chainsaw Massacre School of Programming */
  27. /* Kathy@cup.portal.com */
  28. /* Call the UNBORED BBS (908) 291-0126 */
  29. /* */
  30. /* */
  31. /* Note:To load objects deformed by Bones, you must use Save */
  32. /* Transformed in Layout. This macro will load the position, */
  33. /* rotation, size and pivot point changes of any object */
  34. /* including those with bones or displacement maps, but */
  35. /* not the Bone or Displacement map deformations themselves. */
  36. signal on error
  37. signal on syntax
  38. call addlib( "LWModelerARexx.port", 0 )
  39.  
  40. phile = GETFILENAME("Scene file to load as one object", "Toaster:Scenes" )
  41.   
  42.  if ~open('thisfile', phile, 'r') then do
  43.     call close('thisfile')
  44.     call notify(1,"!Say what? Something wrong with that filename. Load
  45.  aborted.")
  46.     exit
  47.     end
  48. /* This routine makes a list of the line numbers of the load object lines */
  49. /* Since different objects have different amounts of data lines */
  50. /* this keeps a record of where each object begins. Used to reference */
  51. /* info on parent objects */
  52.  momdad = 0
  53.  loadflag = 0
  54.  list = ""
  55.  parent = ""
  56.  point = ""
  57.  pivot = 0
  58. verzion = 0
  59. line = readln('thisfile')
  60. count = 1
  61. do while ~eof('thisfile')
  62.  parse var line first second
  63.  if first = "LoadObject" then do
  64.    list = list count
  65.   end
  66.  if first = "AddNullObject" then do 
  67.    list = list count
  68.    end
  69.  if first = "ParentObject" then do
  70.   parent = parent second
  71.   momdad = 1
  72.   end
  73.  if first = "ShowObject" then do
  74.    verzion = 1
  75.   end  
  76.  
  77.  if first = "PivotPoint" then do
  78.   point = point count
  79.   pivot = 1
  80.   end
  81.  if first = "ShadowOptions" then do 
  82.  if momdad = 0 then do 
  83.  parent = parent||"0"
  84.  end
  85.  if pivot = 0 then do
  86.  point = point||"0"
  87.  end
  88.  if verzion = 1 then
  89.   skipdown = 5
  90.   else 
  91.   skipdown = 4
  92.  
  93.  end
  94.  
  95. line = readln('thisfile')
  96. count = count +1
  97. end
  98. parent = strip(parent,'L',' ')
  99. list = strip(list,'L',' ')
  100. point =strip(point,'L',' ')
  101. call close('thisfile')
  102.  
  103.  
  104.  
  105. /* Part2 - Getting the objects and positioning them */
  106.  
  107.  if ~open('thisfile', phile, 'r') then do
  108.     call close('thisfile')
  109.     call notify(1,"say what?")
  110.     exit
  111.     end
  112.  
  113. /* read the first line in */
  114.  lion = readln('thisfile')
  115. dracula = 1 /* the Count */
  116. do while ~eof('thisfile')
  117. /* divide the line into 2 variables */ 
  118. /* when you get to a load object line, load the file */
  119. parse var lion furst sekond
  120.  if furst = "LoadObject" then do
  121.  
  122.  call setlayer(2)
  123.  sekond = strip(sekond,'L',' ')
  124.  relative = left(sekond,8)
  125.  if (relative = "OBJECTS/") then sekond = "Toaster:"sekond
  126.  if (relative = "Objects/") then sekond = "Toaster:"sekond
  127.  if (relative = "objects/") then  sekond = "Toaster:"sekond 
  128.  if ~open('fisle',sekond,'r') then do
  129.   call notify(1, '!Problem with the file name with scene file.')
  130.   call close('fisle')
  131.   exit
  132.   end
  133.   call close('fisle')
  134.    call load(sekond)
  135.   /* 5 lines down from the Load Object line is the position etc. info */
  136.    do  i = 1 to skipdown
  137.    lion = readln('thisfile')
  138.    end
  139.  /* Put the info into variables */    
  140.  parse var lion EX WHY ZEE H P B SX SY SZ
  141.   numba = dracula
  142.   call checkpoint()
  143.   dracula = dracula + 1
  144.  call transformations()
  145.  
  146.   lion = readln('thisfile')
  147.   parse var lion keyword argument
  148.     do until keyword = "ShadowOptions"
  149.     /* do until end of object section */
  150.     /* read lines from file */
  151.     
  152.     /* divide lines into 2 variables */
  153.     parse var lion ferst zekond
  154.     /* if you find a Parent Object line in an object section */
  155.        if ferst = "ParentObject" then do
  156.         call heritage()
  157.         /* check parent list to see if parent has parent */
  158.         nextparent = word(parent,zekond)
  159.          do while nextparent > 0 
  160.           
  161.           zekond = nextparent
  162.           call heritage()
  163.           nextparent = word(parent,zekond)
  164.           end
  165.         end 
  166.     lion =readln('thisfile')    
  167.      parse var lion keyword argument
  168.     end 
  169.  
  170.   call cut()
  171.   call setlayer(1)
  172.   call paste()
  173.   
  174.  end
  175.     
  176. lion = readln('thisfile')
  177. end
  178.     
  179.   
  180. exit
  181. heritage:
  182.     /* use the object number of the parent object to extract the line */
  183.     /* number of where that parent object's info begins */ 
  184.      linenumber = word(list,zekond)
  185.     /* add 5 to compute line of info */
  186.       linenumber = linenumber + skipdown
  187.     call flipthrough() 
  188.      /* pull the info from that line */  
  189.       parse var zip EX WHY ZEE H P B SX SY SZ
  190.   numba = zekond
  191.   call checkpoint()
  192.    call transformations()
  193.  
  194.  
  195. return 
  196. checkpoint:
  197.  /* extract line number of Pivot Point info */
  198.   linenumber = word(point,numba)
  199.      if linenumber > 0 then do
  200.      call flipthrough()
  201.       parse var zip DISCARD EXP WHYP ZEEP
  202.      /* move the pivot point */
  203.       call move((-EXP) (-WHYP) (-ZEEP))
  204.      end
  205.   return
  206.    
  207. flipthrough:
  208.     /* open another logical file */
  209.     /* read lines 'til you get to the one you want */
  210.       call open('fileagain',phile,'r')
  211.       do thumbthrough = 1 to linenumber
  212.       zip = readln('fileagain')
  213.       end
  214.       call close('fileagain')
  215.       
  216.  return
  217. transformations:
  218.   call MOVE(EX WHY ZEE)
  219.   call ROTATE(-B,Z,EX WHY ZEE)
  220.   call ROTATE(-P,X,EX WHY ZEE)
  221.   call ROTATE(-H,Y,EX WHY ZEE)
  222.  call SCALE(SX SY SZ, EX WHY ZEE) 
  223. return     
  224. syntax:
  225. error:
  226.    call end_all()
  227.    call notify( 1, "!Rexx Script Error", "@"errortext( rc ), "Line "sigl )
  228.    exit
  229. --
  230. Kathy@cup.portal.com sent this message.
  231. To Post a Message           : lightwave@webcom.com
  232. Un/Subscription Requests To : lightwave-request@webcom.com
  233. (DIGEST)                 or : lightwave-digest-request@webcom.com
  234. Administrative Items To     : owner-lightwave@webcom.com